package scau.filesystem.bean;

import java.lang.reflect.Field;

public class Student {
	
	private int id;
	
	private String username;
	
	private String password;
	
	private Student student;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public static void main(String[] args) throws IllegalAccessException {
		Student s = new Student();
		s.setId(1);
		s.setPassword("4353453%");
		s.setUsername("sffadfasd");
		try {
			Class clazz = Student.class;
			System.out.println(clazz.getName());
			Field[] fields = clazz.getDeclaredFields();
			String f_n = null;
			String type = null;
			for(Field f : fields){
				f.setAccessible(true);
				System.out.print(f_n = "" + f.getName());
				type = f.getType().getSimpleName();
				System.out.print("---" + (type));
				if(type.equals("int"))
					System.out.println("---" + f.getInt(s));
				else if(type.equals("String"))
					System.out.println("---" + f.get(s));
			}
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} 
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

}
